#include <iostream>

#include "StateOne.h"
#include "StateTwo.h"
#include "StateThree.h"
#include "MessageTypes.h"

using walker_sm::Entity;
using walker_sm::State;
using walker_sm::Message;

StateOne* StateOne::GetInstance()
{
	static StateOne instance;
	return &instance;
}

StateOne::StateOne()
{
}


StateOne::~StateOne()
{
}

void StateOne::Enter(Entity* entity)
{
	std::cout << "Enter State One" << std::endl;
}

void StateOne::Excute(Entity* entity)
{
	std::cout << "Excute State One" << std::endl;
}

void StateOne::Exit(Entity* entity)
{
	std::cout << "Exit State One" << std::endl;
}

bool StateOne::HandleMessage(Entity* entity, const Message& msg)
{
	switch (msg.msg)
	{
	case MessageTypes::MT_Switch1:
		{
			entity->GetFSM()->ChangeState(StateOne::GetInstance());
			return true;
		}
	case MessageTypes::MT_Switch2:
		{
			entity->GetFSM()->ChangeState(StateTwo::GetInstance());
			return true;
		}
	case MessageTypes::MT_Switch3:
		{
			entity->GetFSM()->ChangeState(StateThree::GetInstance());
			return true;
		}
	default:
		{
			break;
		}
	}
	return false;
}